package o;

import com.huawei.hms.framework.network.util.HttpUtils;
import java.net.MalformedURLException;
import java.net.URL;

public abstract class dns implements dnr, dmi {
    private b ʻ;
    protected String ʽ;
    protected String ˊ = "";
    protected boolean ˋ = true;
    protected String ˎ = "LoggerMaker";
    protected String ˏ;
    protected String ॱ = "";

    protected abstract String ˊ();

    public String ˋ() {
        return this.ˎ;
    }

    public void ˏ(String str, b bVar) {
        if (ˋ(str)) {
            this.ʻ = bVar;
            this.ˋ = false;
            dmq.ˏ.ˊ(dmp.CONCURRENT, this);
        }
    }

    public void run() {
        Logger.ˎ(this.ˎ, this.ˎ + " excute() start ");
        String str = "";
        try {
            str = ˊ();
        } catch (Exception e) {
            Logger.ˋ(this.ˎ, "diagnose Exception:" + e.toString());
        }
        ˏ(str);
    }

    public boolean ॱ() {
        return this.ˋ;
    }

    private void ˏ(String str) {
        this.ʽ = str;
        this.ˋ = true;
        if (this.ʻ != null) {
            this.ʻ.ˎ(this);
        }
    }

    public String ˎ() {
        return dof.ʼ(this.ʽ);
    }

    public String toString() {
        return getClass().getSimpleName();
    }

    private boolean ˋ(String str) {
        if (dof.ˋ(str)) {
            Logger.ˋ(this.ˎ, "checkUrl invalid , url is empty");
            return false;
        }
        try {
            URL url = new URL(str);
            this.ˏ = url.getProtocol();
            if (dof.ˋ(this.ˏ)) {
                this.ˏ = HttpUtils.HTTP_PREFIX;
            } else {
                this.ˏ += "://";
            }
            this.ˊ = url.getHost();
            if (dof.ˋ(this.ˊ)) {
                Logger.ˋ(this.ˎ, "checkUrl invalid , host is empty");
                return false;
            }
            if (url.getPort() != -1) {
                this.ॱ = ":" + url.getPort();
            }
            return true;
        } catch (MalformedURLException e) {
            Logger.ˋ(this.ˎ, "checkUrl invalid , url is not valid.MalformedURLException=" + e.toString());
            return false;
        }
    }
}
